# -*- coding: utf-8 -*-
import os
# debug mode
debug = True

# get current directory
from os.path import abspath, dirname, join
base_path = abspath(dirname(__file__))

# system path
import sys
sys.path.insert(0, abspath(join(base_path, '..', 'lib')))

# configure session


# set template directory
from jinja2 import Environment, PackageLoader
env = Environment(loader=PackageLoader('${project_name}', 'templates'), auto_reload=debug)

# database configuration
from accost.utils import ThreadSafeStore
db = {}
store = ThreadSafeStore('mysql://username:password@localhost:3306/dbname')
#db['store'] = store

# logging
import logging
from logging.handlers import TimedRotatingFileHandler
#hdlr = TimedRotatingFileHandler(join(base_path, 'static', 'log', '${project_name}.log'), 'MIDNIGHT')
hdlr = logging.StreamHandler(sys.stdout)
hdlr.setFormatter(logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s'))
hdlr.setLevel(logging.NOTSET)
logging.root.addHandler(hdlr)
logging.root.setLevel(logging.NOTSET)
